'''
菜单栏\工具栏\状态栏
'''

import sys,math
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

class Windows(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("Hello world!")
        self.setGeometry(300, 300, 400, 400)
        bar = self.menuBar()

        files = bar.addMenu("files")
        files.addAction('new')

        save = QAction("save", self)
        save.setShortcut("Ctrl + s")
        files.addAction(save)

        edit = bar.addMenu("Edit")
        run = QAction("run", self)
        debug = QAction("debug", self)
        edit.addAction(run)
        edit.addAction(debug)

        save.triggered.connect(self.process)

        tb1 = self.addToolBar("Files")

        new = QAction(QIcon('../controls/python.png'), "new", self)
        tb1.addAction(new)
        open_ = QAction("open", self)
        tb1.addAction(open_)

        self.setCentralWidget(QTextEdit())
        self.statusBar = QStatusBar()
        self.statusBar.addAction()
        self.setStatusBar(self.statusBar)

    def process(self, a):
        print(self.sender().text())
if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Windows()
    ex.show()
    sys.exit(app.exec_())